package com.xsm.takephoto;

import com.xsm.activitygroup.R;

import android.R.integer;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;

public class Photo extends Activity{
	ImageView imageView;
	int num=0;
	Bitmap bitmap;
	Button delete;
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	setContentView(R.layout.photo);
	imageView=(ImageView)findViewById(R.id.photo);
	String path=getIntent().getExtras().getString("path");
	num=getIntent().getExtras().getInt("index");
	 BitmapFactory.Options options = new BitmapFactory.Options(); 
	 options.inJustDecodeBounds =false;
	  bitmap=BitmapFactory.decodeFile(path,options);
	 imageView.setImageBitmap(bitmap);
	delete=(Button)findViewById(R.id.delete);
	delete.setBackgroundResource(android.R.drawable.ic_menu_delete);
}
public void Back(View view){
	if (null != bitmap && !bitmap.isRecycled()){
		bitmap.recycle();
		bitmap = null;
	     }
	finish();
}
public void Delete(View view){
Intent intent =new Intent();
intent.putExtra("num", num);
setResult(RESULT_OK, intent);

if (null != bitmap && !bitmap.isRecycled()){
	bitmap.recycle();
	bitmap = null;
     }
finish();
}

}
